cmake_minimum_required(VERSION 3.4)
project(jpeg-compressor)

include(conanbuildinfo.cmake)
conan_basic_setup()

set(JPEGCOMPRESSOR_SOURCE_SUBFOLDER "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# jgpd lib

set(JPGD_SRC_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpgd.cpp)
set(JPGD_HDR_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpgd.h ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpgd_idct.h)
add_library(jpgd ${JPGD_SRC_LIST} ${JPGD_HDR_LIST})
target_include_directories(jpgd PUBLIC ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER})

install(TARGETS jpgd)
install(FILES ${JPGD_HDR_LIST} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

# jgpe lib

set(JPGE_SRC_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpge.cpp)
set(JPGE_HDR_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpge.h ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpge.h)
add_library(jpge ${JPGE_SRC_LIST} ${JPGE_HDR_LIST})
target_include_directories(jpge PUBLIC ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER})

install(TARGETS jpge)
install(FILES ${JPGE_HDR_LIST} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
